$def with (posts, login_form)
<h1>Blog posts</h1>
$if not cookie().get('username'):
  <form action="" method="POST">
  $:login_form.render()
  </form>
$else:
  欢迎 $cookie().get('username')!<a href="/logout">登出</a>
<ul>
    $for post in posts:
      <li>
          <a href="/view/$post.id">$post.title</a>
          &nbsp; $post.posted_on
          $if cookie().get('username'):
            <a href="/edit/$post.id">编辑</a>
            <a href="/delete/$post.id">删除</a>
      </li>
</ul>